package com.umeox.watch.moto.dataservice.db.model;


import androidx.annotation.NonNull;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

@Entity(tableName = ContactInfo.TABLE_NAME)
public class ContactInfo {
    @Ignore
    public static final String TABLE_NAME = "contact_info";

    @NonNull
    @PrimaryKey
    private long contactId;
    /**
     * 对应系统电话簿字段 {@link android.provider.ContactsContract.Data#RAW_CONTACT_ID}
     */

    private long rawContactId;

    private String name;

    private String phone;

    private String photoUrl;

    private String photoPath;
    /**
     * 联系人类型
     * 0: 管理员增加
     * 1: 管理员
     * 2：APP关注者
     * 3：设备好友
     */

    private int type;
    /**
     * 当 type=[0，1]时，值为APP 用户ID
     * 当 type=[2]时，值为空
     * 当 type=[4]时，值为设备持有用户ID
     */

    private String friendId;

    private long createTime;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getFriendId() {
        return friendId;
    }

    public void setFriendId(String friendId) {
        this.friendId = friendId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public long getContactId() {
        return contactId;
    }

    public void setContactId(long contactId) {
        this.contactId = contactId;
    }

    public long getRawContactId() {
        return rawContactId;
    }

    public void setRawContactId(long rawContactId) {
        this.rawContactId = rawContactId;
    }

    public String getPhotoUrl() {
        return photoUrl;
    }

    public void setPhotoUrl(String photoUrl) {
        this.photoUrl = photoUrl;
    }

    public String getPhotoPath() {
        return photoPath;
    }

    public void setPhotoPath(String photoPath) {
        this.photoPath = photoPath;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof ContactInfo)) return false;

        ContactInfo that = (ContactInfo) o;

        return contactId == that.contactId;
    }

    @Override
    public int hashCode() {
        return (int) (contactId ^ (contactId >>> 32));
    }

    @Override
    public String toString() {
        return "ContactInfo{" +
                "contactId=" + contactId +
                ", rawContactId=" + rawContactId +
                ", name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", photoUrl='" + photoUrl + '\'' +
                ", photoPath='" + photoPath + '\'' +
                ", type=" + type +
                ", friendId='" + friendId + '\'' +
                ", createTime=" + createTime +
                '}';
    }
}
